OUTPUT=dbengine
SOURCE=main.l

TEMP = -DTEMP
FLAGS = 
#-Wall
DEBUGFLAGS = -g -DDEBUG

LEXFILE=lex.yy.cc

all:
	flex -+ $(SOURCE)
	g++ $(FLAGS) $(LEXFILE) -o $(OUTPUT) -lfl

temp:
	flex -+ $(SOURCE)
	g++ $(FLAGS) $(DEBUGFLAGS) $(TEMP) $(LEXFILE) -o $(OUTPUT) -lfl

debug:
	flex -+ $(SOURCE)
	g++ $(FLAGS) $(DEBUGFLAGS) $(LEXFILE) -o $(OUTPUT) -lfl

clean:
	rm -f $(OUTPUT)
	rm -f $(LEXFILE)
	rm -f *.db *.tbl *.idx

cleanall: clean all

cleandebug: clean debug

run: all
	./dbengine < sample.qry

sample: debug
	./dbengine < sample.qry

diff:
	svn diff

backup:
	tar -zcvf ~/bkups/bkup_`date +%d%m%y`_`date +%H%M`.tgz *
	chmod 444 ~/bkups/*
	ls -l ~/bkups/

extract:
	tar -zxvf ~/bkup.tgz

query:
	g++ myqueries.cpp
	./a.out > sample.qry
	rm a.out

docs: tags
	rm -rf html latex
	doxygen config.doxygen

tags:
	rm -f tags
	ctags -R *
